import logging
import sys
from pathlib import Path

user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.54'
date_format = '%Y-%m-%d'
log_dir = Path('log')
if not log_dir.exists():
    log_dir.mkdir()
log_file = log_dir.joinpath('farm.log')
logging.basicConfig(
    format='%(asctime)s %(filename)s,L%(lineno)d [%(levelname)s] %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S',
    handlers=[
        logging.FileHandler(filename=str(log_file), mode='a',
                            encoding='utf-8'),
        logging.StreamHandler(stream=sys.stdout),
    ],
    level=logging.INFO)
